package com.suray.basic.wcs.plc.enums;

public enum CargoState {
    No_CARGO("无货", 2),
    HAS_CARGO("有货", 1);
    private String desc;
    private int cargoState;

    CargoState(String desc, int cargoState) {
        this.desc = desc;
        this.cargoState = cargoState;
    }

    public String getDesc() {
        return desc;
    }

    public int getCargoState() {
        return cargoState;
    }

    public static CargoState parseCargoStateCode(int cargoSate) {
        CargoState[] values = CargoState.values();
        for (CargoState cargoState : values) {
            if (cargoState.getCargoState() == cargoSate) {
                return cargoState;
            }
        }
        throw new RuntimeException("找不到货物状态");
    }
}
